package org.hhgzs.modules.erp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hhgzs.modules.erp.constants.BusinessConstants;
import org.hhgzs.modules.erp.entity.Person;
import org.hhgzs.modules.erp.entity.Supplier;
import org.hhgzs.modules.erp.mapper.PersonMapper;
import org.hhgzs.modules.erp.service.PersonService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 经手人表 服务实现类
 * </p>
 *
 * @author peiqy
 * @since 2021-07-14
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person> implements PersonService {

    private final PersonMapper personMapper;


    @Override
    public List<Person> getPersonByType(String type) {
        QueryWrapper<Person> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(Person::getType, type);
        queryWrapper.lambda().ne(Person::getDeleteFlag, BusinessConstants.DELETE_FLAG_DELETED);
        queryWrapper.lambda().orderBy(true, true, Person::getId);
        List<Person> list = list(queryWrapper);
        return list;
    }
}
